package com.code.exam.common.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
public class PageResult<T> {

    private Long total;//总记录总数
    private Integer page;  //当前页码
    private Integer pageSize;  //当前页的记录数
    private List<T> records;//当前页数据


    public PageResult( Long total, Integer page,Integer pageSize,List<T> records) {

        this.total = total;
        this.page = page == null || page < 1 ? 1 : page;
        this.pageSize = pageSize == null || pageSize < 1 ? 1 : pageSize;
        this.records = records;
    }
}
